// SETUP

#include endepisodegraphics_ladyluck.txt

// HELPER FUNCTIONS	

function signanimate(sign) {
	var s = sign.show("turn");
	//s.onComplete(function() { resume(); sign.show("loop"); });
	//pause();
	while(!s.completed) {
		// do nothing
	}
	sign.show("loop");
}

function spinthewheel(sign, wheel) {
  var s = sign.show("turn");
	//s.onComplete(function() { resume(); sign.show("loop"); });
	//pause();
	while(!s.completed) {
		// do nothing
	}
	sign.hide();
	
  wheel.x = 30;
  wheel.y = -30;
  play("spinthewheel");
	var s = wheel.show("spin1");
	//s.onComplete(function() { resume(); sign.show("loop"); });
	//pause();
	while(!s.completed) {
		// do nothing
	}
	wheel.hide();
}

// ACTORS
actor("Lady Luck", screenwidthmid + 400, 100, Col.YELLOW, LEFT, TOP, "chat_ladyluck", "characters/misc/charicon_ladyluck");

// INTRO

play("music_cutscene_lesscheery");

changebackground("intro_sign");

sign.y = -screenheight;
ladyluck_sign.y = -screenheight;
sign.show("loop");
ladyluck_sign.show("idle");

Actuate.tween(sign, 2, { y: 0 }).ease(Expo.easeOut);
Actuate.tween(ladyluck_sign, 2, { y: 0 }).ease(Expo.easeOut);

wait(0.5);

fadein();

wait(1.5);

ladyluck_sign.show("talking"); 
actor("Lady Luck", screenwidthmid + 400, 100, Col.YELLOW, LEFT, TOP, "chat_ladyluck", "characters/misc/charicon_ladyluck");
speak("Lady Luck", "I suppose I’m just going to have to|do this myself. Ridiculous.");
ladyluck_sign.show("idle");

ladyluck_sign.hide();

spinthewheel(sign, wheel);

signanimate(sign);

ladyluck_sign.show("talking");
actor("Lady Luck", screenwidthmid + 400, 100, Col.YELLOW, LEFT, TOP, "chat_ladyluck", "characters/misc/charicon_ladyluck");
speak("Lady Luck", "You know the drill: well done blah blah|blah, I’ve spun the wheel...");
speak("Lady Luck", "...but OH LOOK.");
speak("Lady Luck", "It seems like you don’t win your|heart’s desire this time.");
speak("Lady Luck", "What a shock.");
ladyluck_sign.show("idle");

gamecompletefromcutscene();
